package com.chinaunicom.order.domain.model.valobj;

import lombok.Getter;

/**
 * @author guomenghuai
 * @date 2024/1/10
 * @Description
 */
@Getter
public enum OrderStatus {

    NULL(0, "未知"),
    CREATED(10, "已创建"),
    PAID(20, "已支付"),
    FULFILL(30, "已履约"),
    OUT_STOCK(40, "出库"),
    DELIVERY(50, "配送中"),
    SIGNED(60, "已签收"),
    CANCELED(70, "已取消"),
    REFUSED(100, "已拒收"),
    INVALID(127, "无效订单");

    private Integer code;

    private String msg;

    OrderStatus(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static OrderStatus getByCode(Integer code) {
        for (OrderStatus ele : values()) {
            if (code.equals(ele.getCode())) {
                return ele;
            }
        }
        return null;
    }
}
